package com.example.demo.wbgl.controller;


import com.example.demo.conf.FileUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.util.*;

@RestController
@RequestMapping
public class TestController {
    /**
     * @Author GongXL
     * @Description  获得图片路径
     * @Date 11:08 2021/12/8
     * @Param []
     * @return java.util.List<java.lang.String>
     **/
    @RequestMapping("/findYou/getGameTimeImgs")
    public List<String> getGameTimeImgs(){
        File folder = new File("/root/nginx_s/aliyun_html/mysite/img/happy_moment/langrensha");
        List<String> filePath  = new ArrayList<String>();
        FileUtil.getFileList(folder,filePath);
        return filePath;
    }
    @RequestMapping("/home/getProductsInfo")
    public List<Map> getProductsInfo(){
        List list = new ArrayList();
//        Random r = new Random(10l);
//        for (int i = 1; i < 10; i++) {
//            Map map = new HashMap();
//            map.put("id",i);
//            map.put("quantity",r.nextInt(100));
//            map.put("name","商品"+Math.random());
//            list.add(map);
//        }
        return list;
    }
    @RequestMapping("/home/data")
        public List<Map> getBlogPageList(){
            List list = new ArrayList();
            for (int i = 0; i < 10; i++) {
                Map map = new HashMap();
                map.put("img","https://oscimg.oschina.net/oscnet/up-0d41f3674cb94fb314058c21c9d58dc8877.png");
                map.put("title","测试内容"+Math.random());
                map.put("price",Math.random());
                map.put("cfav",Math.random());
                list.add(map);
            }
            return list;
    }

}

